<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: wanggege
  Date: 2020/8/31
  Time: 8:01 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%@ include file="common/head.jsp" %>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.2/umd/popper.min.js"></script>
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<script src="../bootstrap/js/bootstrap.min.js"></script>
<link href="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/locale/bootstrap-table-zh-CN.min.js"></script>
<div class="container">
    <strong>你现在所在的位置是:</strong>
    <span>学生管理</span>
    <div class="row">
    </div>
    <div class="col-md-4 column">
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="col-md-4 column">
                <a class="btn btn-info" href="servlet?param=toAdd">新增学生</a>
            </div>
            <table id="table">
                <thead>
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>出生日期</th>
                    <th>邮箱</th>
                    <th>所属班级</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${sessionScope.studentList}" var="student">
                    <tr>
                        <td>${student.id}</td>
                        <td>${student.name}</td>
                        <td>${student.sex}</td>
                        <td>${student.birthday}</td>
                        <td>${student.email}</td>
                        <td>${student.clazz.grade}${student.clazz.className}</td>
                        <td>${student.remark}</td>
                        <td>
                            <a href="servlet?param=toUpdate&id=${student.id}" id="up">修改</a> |
                            <a href="servlet?param=del&id=${student.id}" id="del"> 删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>

<script>
    $("#table").bootstrapTable({
        height: 350,//行高
        toggle:"table",
        pagination: true,
        //showPaginationSwitch: true,
        pageSize: 5,
        pageList: [5, 10, 15, 20],
        striped: true,
        pageNumber:1,
        //showToggle: true,   //是否显示详细视图和列表视图的切换按钮
        search: true,
    })

    $("#del").click(function (){
        if(confirm("是否删除数据？")){
           return true;
        }else {
            return false;
        }
    })
</script>

